package com.gxa.learning.pc.controller;

import com.gxa.learning.core.common.JsonResult;
import com.gxa.learning.core.pojo.Company;
import com.gxa.learning.pc.service.CompanyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author lijianmin
 * @date 2021/12/07  20:19:21
 */
@RestController
@RequestMapping("/company")
@Api(tags = "公司的接口")
public class CompanyController {


    @Autowired
    private CompanyService companyService;

    /**
     * 获取所有的公司信息
     *
     * @return 返回所有公司的集合
     */
    @GetMapping("selectAll")
    @ApiOperation("获取所有公司")
    public Map<String, Object> selectAll() {
        List<Company> companies = companyService.selectAll();
        JsonResult jsonResult = new JsonResult();
        jsonResult.setData(companies);
        jsonResult.setCode("1");
        jsonResult.setMsg("查询成功");
        return jsonResult.getDataMap();
    }
}
